	package com.mad.gdrapps;
	
	import java.util.ArrayList;  
	import android.content.Context;  
	import android.graphics.Canvas;  
	import android.graphics.drawable.Drawable;  
	import com.google.android.maps.GeoPoint;  
	import com.google.android.maps.ItemizedOverlay;  
	import com.google.android.maps.MapView;  
	import com.google.android.maps.OverlayItem;  
	
	public class MyItemizedOverlayS extends ItemizedOverlay<OverlayItem> {  
			
		private ArrayList<OverlayItem> overlayItemList = new ArrayList<OverlayItem>();  
			
			Context context;  
			
			public MyItemizedOverlayS(Drawable marker, Context c) {  
				super(boundCenterBottom(marker));  
				// TODO Auto-generated constructor stub  
				populate();  
				context = c;  
			}  
			
			public boolean nP(GeoPoint p, MapView mapView, float lat, float lon) {  
			      // TODO Auto-generated method stub  
			      String title = "pt:" + String.valueOf(overlayItemList.size() + 1);  
			      String snippet = "geo:\n"  
			       + String.valueOf(lat) + "\n"  
			       + String.valueOf(lon);  
			      addItem(p, title, snippet);  
			      return true;  
			}
			
			public void addItem(GeoPoint p, String title, String snippet){  
				OverlayItem newItem = new OverlayItem(p, title, snippet);  
				overlayItemList.add(newItem);  
				populate();  
			}  
			
			@Override  
			protected OverlayItem createItem(int i) {  
				// TODO Auto-generated method stub  
				return overlayItemList.get(i);  
			}  
			@Override  
			public int size() {  
				// TODO Auto-generated method stub  
				return overlayItemList.size();  
			}  
			@Override  
			public void draw(Canvas canvas, MapView mapView, boolean shadow) {  
				// TODO Auto-generated method stub  
				super.draw(canvas, mapView, shadow);  
			}  
	}  
	
	